//用法: winFn.chosenOpts({url:urlUserList,params:{word:'1376512'},selector:'form_chosen_select',change:function(value,text){},getValue:function(value,text){}});参数params为空则不请求后台
//仅取值时使用:self.jqChosen.val();取值及文本 winFn.chosenValue('form_chosen_select');
function chosenOpts(options){
  var url = options.url;
  var params = options.params || null;
  var selector = options.selector;//无需带#的id',仅支持id
  var change = options.change || null;//值改变事件
  var jqSelector = $('#'+selector);
  //初始化完成后触发
  jqSelector.on("chosen:ready",function(){
    if(params){
      winFn.chosenSelect(url,params,selector);
    }
    var chosen_input = $('#'+selector+'_chosen input');
    chosen_input.on("input",function(event){
      var thisVal = $(this).val();
      winFn.chosenSelect(url,{word:thisVal},selector,thisVal);
    });
  });
  //参考  https://blog.csdn.net/cheng1a/article/details/126645106
  jqSelector.chosen({
    disable_search_threshold : 0,
    no_results_text : '暂无匹配选项请换个关键字',
    width : '100%',
    allow_single_deselect : true
  });
  //点击下拉列表
  jqSelector.on("chosen:showing_dropdown",function(){});
  jqSelector.on('change',function(attrs,val){
    if(change){
      var value = jqSelector.val();
      var text = jqSelector.find("option:selected").text();
      change(value,text);//第一个有值时第2个才有值
    }
  });
  return jqSelector;
}